package fiuba.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.JoinColumn;

import fiuba.service.GenericManager;

import fiuba.service.impl.GenericManagerImpl;
import fiuba.dao.hibernate.GenericDaoHibernate;

import java.lang.Comparable;
@Entity
public class ItemContenedor extends BaseObject implements Comparable<ItemContenedor> {
	private GenericManager<ContenidoEstatico, Long> contenidoEstaticoManager;

	/**
	 * 
	 */
	private static final long serialVersionUID = -4794635807498415586L;
	private Long id;
	private Integer nroSecuencia;
	private String Tipo;
	private Long idExterno;
	private boolean breakAfter;
	private Integer leftSpacing;
	private Integer rightSpacing;
	private Integer topSpacing;
	private Integer bottomSpacing;
	
	private Contenedor contenedor;
	
	@Id @GeneratedValue(strategy = GenerationType.AUTO) 
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}
	@Column
	public Integer getNroSecuencia() {
		return nroSecuencia;
	}

	public void setNroSecuencia(Integer nroSecuencia) {
		this.nroSecuencia = nroSecuencia;
	}
	@Column(length=30)
	public String getTipo() {
		return Tipo;
	}

	public void setTipo(String tipo) {
		Tipo = tipo;
	}
	@Column
	public Long getIdExterno() {
		return idExterno;
	}

	public void setIdExterno(Long idExterno) {
		this.idExterno = idExterno;
	}
	@Column
	public boolean isBreakAfter() {
		return breakAfter;
	}

	public void setBreakAfter(boolean breakAfter) {
		this.breakAfter = breakAfter;
	}
	@Column
	public Integer getLeftSpacing() {
		return leftSpacing;
	}

	public void setLeftSpacing(Integer leftSpacing) {
		this.leftSpacing = leftSpacing;
	}
	@Column
	public Integer getRightSpacing() {
		return rightSpacing;
	}

	public void setRightSpacing(Integer rightSpacing) {
		this.rightSpacing = rightSpacing;
	}
	@Column
	public Integer getTopSpacing() {
		return topSpacing;
	}

	public void setTopSpacing(Integer topSpacing) {
		this.topSpacing = topSpacing;
	}
	@Column
	public Integer getBottomSpacing() {
		return bottomSpacing;
	}

	public void setBottomSpacing(Integer bottomSpacing) {
		this.bottomSpacing = bottomSpacing;
	}

	@Override
	public boolean equals(Object o) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public int hashCode() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return null;
	}

	@ManyToOne
    @JoinColumn(name="contenedor_fk")
	public Contenedor getContenedor() {
		return contenedor;
	}

	public void setContenedor(Contenedor contenedor) {
		this.contenedor = contenedor;
	}

	
	public int compareTo(ItemContenedor i){
		return this.nroSecuencia.compareTo(i.getNroSecuencia());
	}

	public void setContenidoEstaticoManager(
			GenericManager<ContenidoEstatico, Long> contenidoEstaticoManager) {
		this.contenidoEstaticoManager = contenidoEstaticoManager;
	}
}
